//
//  ShowLayoutTableViewCell.m
//  QXShowing
//
//  Created by 王道道 on 2018/5/1.
//  Copyright © 2018年 doll_dream. All rights reserved.
//

#import "ShowLayoutTableViewCell.h"

@implementation ShowLayoutTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initView];
    }
    return self;
}

- (void)initView {
    UIView *bgView = [[UIView alloc] init];
    bgView.layer.masksToBounds = YES;
    bgView.layer.cornerRadius = 5;
    bgView.layer.borderColor = [UIColor blackColor].CGColor;
    bgView.layer.borderWidth = 0.5;
    [self.contentView addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).offset(15);
        make.top.equalTo(self.contentView.mas_top).offset(15);
        make.centerX.equalTo(self.contentView);
        make.bottom.equalTo(self.contentView.mas_bottom);
    }];
    
    //标题
    self.nameLabel = [[UILabel alloc]init];
    self.nameLabel.textColor = Text_Color_333333;
    self.nameLabel.text = @"A区";
    self.nameLabel.font = BHFont_Size_18;
    [bgView addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bgView.mas_top).offset(10);
        make.centerX.equalTo(bgView);
    }];
    
    //简介
    self.messageLabel = [[UILabel alloc]init];
    self.messageLabel.textColor = Text_Color_333333;
    self.messageLabel.text = @"(汽车配件馆)";
    self.messageLabel.font = BHFont_Size_12;
    [bgView addSubview:self.messageLabel];
    [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameLabel.mas_bottom).offset(5);
        make.centerX.equalTo(bgView);
    }];
}

- (void)setModel:(HomeShowLayoutSubModel *)model {
    if (![BHSettingUtil dataAndStringIsNull:model]) {
        _model = model;
        self.nameLabel.text = [BHSettingUtil dataAndStringIsNull:model.area_name]?@"":model.area_name;
        self.messageLabel.text = [BHSettingUtil dataAndStringIsNull:model.area_tag_name]?@"":[NSString stringWithFormat:@"%@",model.area_tag_name];
    }
}

@end
